target remote :{{config.probe.jlink.port}}
{{#if reset}}
monitor reset
{{/if}}

{{#set "DRONE_REG"}} {{addr config.memory.ram.origin}} + {{addr config.memory.ram.size}} - {{addr config.heap.size}} {{/set}}
{{#set "DSO_PORTS"}} ({{get "DRONE_REG"}} - 4) {{/set}}
set {int}{{get "DSO_PORTS"}} = 0{{#each ports}} | (1 << {{this}}){{/each}}

shell echo -n "1" > {{pipe}}
shell cat {{pipe}} > /dev/null
continue
monitor go
